package com.kaoshi.myweb.common.seachable;

import java.util.ArrayList;
import java.util.List;

public class OrderCriteria {
	
	
	protected List<OrderCriterion> orderCriterions;
	
	public OrderCriteria(){
		orderCriterions = new ArrayList<OrderCriteria.OrderCriterion>();
	}
	
	
	public OrderCriteria addOrderCriteria(String orderField, SqlOrder sqlOrder) {
		orderCriterions.add(new OrderCriterion(orderField, sqlOrder));
		return this;
	}
	
	public void addAscFields(String ascFields) {
		orderCriterions.add(new OrderCriterion(ascFields, SqlOrder.asc));
	}
	
	public void addDescFields(String descFiedls) {
		orderCriterions.add(new OrderCriterion(descFiedls, SqlOrder.desc));
	}
	
	
	public List<OrderCriterion> getOrderCriterions() {
		return orderCriterions;
	}





	public static class OrderCriterion{
		
		private String orderField;
		
		private SqlOrder sqlOrder;
		
		
		public OrderCriterion(String orderField, SqlOrder sqlOrder) {
			this.setOrderField(orderField);
			this.setSqlOrder(sqlOrder);
		}


		public String getOrderField() {
			return orderField;
		}


		public void setOrderField(String orderField) {
			this.orderField = orderField;
		}


		public SqlOrder getSqlOrder() {
			return sqlOrder;
		}


		public void setSqlOrder(SqlOrder sqlOrder) {
			this.sqlOrder = sqlOrder;
		}
		
		
	}
}
